<template>
  <div id="cart">
    <!--顶部导航栏-->
    <nav-bar class="nav-bar">
      <div slot="center">购物车({{cartLength}})</div>
    </nav-bar>
    <!--购物车列表展示-->
    <scroll ref="scroll" class="content" :propsType="3">
      <cart-list></cart-list>
    </scroll>
    <!--底部导航栏-->
    <cart-bottom-bar></cart-bottom-bar>
  </div>

</template>

<script>
  import NavBar from "components/common/navbar/NavBar";
  import CartList from "./childComponents/CartList";
  import Scroll from "components/common/scroll/Scroll";
  import CartBottomBar from "./childComponents/CartBottomBar";

  import {mapGetters} from "vuex"
  export default {
    name: "Cart",
    components: {
      CartList,
      NavBar,
      Scroll,
      CartBottomBar,
    },
    computed:{
      ...mapGetters(['cartLength'])
    },
    activated() {
      this.$refs.scroll.refresh();
    }
  }
</script>

<style scoped>
  #cart {
    height: 100vh;
    position: relative;
    padding-top: 44px;
  }
  .nav-bar {
    color: var(--color-background);
    background-color: var(--color-high-text);
    font-size: 16px;
    text-align: center;

    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
  }

  .content {
    height: calc(100% - 44px - 40px );
  }
</style>
